// 校验类

export const validateEmail = value => {
    let regEmail = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/
    return regEmail.test(value)
}
export const validatePassword = value => {
    let regPassword = /^(?=.*\d)(?=.*[A-z])[\da-zA-Z]{6,20}$/
    return regPassword.test(value)
}
export const validateCode = value => {
    let regCode = /^[0-9]{4}$/
    return regCode.test(value)
}
export const validateTelephone = value => {
    let regTelephone =
        /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
    return regTelephone.test(value)
}

export const validateEmailOrTelephone = value => {
    let reEmailOrTelephone =
        /(^0{0,1}(13[0-9]|15[7-9]|153|156|18[7-9])[0-9]{8}$)|(^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$)/i
    return reEmailOrTelephone.test(value)
}
